home *** CD-ROM | disk | FTP | other *** search
- Path: news.cencom.net!ns!tanp
- From: tanp@ns (Bill Wendling)
- Newsgroups: comp.lang.c
- Subject: Re: HELP!!!!!!!
- Date: 5 Feb 1996 07:09:50 GMT
- Organization: Cen-Com Internet
- Message-ID: <4f4afu$4c2@news.cencom.net>
- References: <3112CFDA.85@utoronto.ca>
- NNTP-Posting-Host: ns.cencom.net
- X-Newsreader: TIN [version 1.2 PL2]
-
- Dave Goldstein inexplicably wrote:
- } I am a frustrated new C programmer, with a big headache:
- } I've composed a linked list in a function, and I am passing the HEAD of
- } the list into the function. Of course, when I pass this into the
- } function, I have to dereference it twice (**head) since I pass it in as
- } &head.
-
- Since this is a linked list, why are you passing head in as &head? You
- should just be able to pass it in as head to a function expecting
- the address of head.
-
- } Anyway, to make a long story short, when I try accessing the
- } first item in the linked list (assuming there is one), I have tried
- } accessing it as **head->next which C doesn't seem to like. WHY????!!
- } It keeps giving me an error "Pointer to structure required on left side
- } of -> or ->* in function ....". Isn't that what I'm doing??
-
- The -> thingy really dereferences the thing it is pointing to. So,
- **head->next is really **(*head).next which isn't what you want.
- You might try changing it to (*head)->next instead. That might help,
- however, I don't have code to go on.
-
- } Please help, I'm beginning to feel suicidal!
- } If you wish to mail me please write to:
-
- } dave.goldstein@utoronto.ca
-
- } I'll be forever in your debt! Thanks.
-
- Hmmm...:)
-
- --
- Bill Wendling | "Pinky, are you thinking what I'm thinking?"
- tanp@ns.cencom.net | "I think so, Brain, but burlap chafes me so."
- "Boom Shanka" | Finger me for my Geek Code...NOW!
-